{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "!tensorflowjs_converter --help"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "!tensorflowjs_converter --input_format keras \\\n",
    "    --output_format tfjs_layers_model \\\n",
    "    ./graph_def_and_weights/fashion_mnist_model.h5 \\\n",
    "    ./tfjs_models/keras_to_tfjs_layers"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2019-08-11 09:56:58.293151: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA\n",
      "2019-08-11 09:56:58.299868: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 2300000000 Hz\n",
      "2019-08-11 09:56:58.300220: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x5587b2a34260 executing computations on platform Host. Devices:\n",
      "2019-08-11 09:56:58.300457: I tensorflow/compiler/xla/service/service.cc:175]   StreamExecutor device (0): <undefined>, <undefined>\n",
      "WARNING: Logging before flag parsing goes to stderr.\n",
      "W0811 09:56:58.459062 139712433248000 deprecation.py:323] From /home/stdcoutzyx/.local/lib/python3.5/site-packages/tensorflow/python/ops/math_grad.py:1250: add_dispatch_support.<locals>.wrapper (from tensorflow.python.ops.array_ops) is deprecated and will be removed in a future version.\n",
      "Instructions for updating:\n",
      "Use tf.where in 2.0, which has the same broadcast rule as np.where\n",
      "2019-08-11 09:56:59.015078: W tensorflow/core/common_runtime/eager/context.cc:371] Added two functions with the same name: __inference__wrapped_model_500\n",
      "2019-08-11 09:56:59.024111: W tensorflow/python/util/util.cc:280] Sets are not currently considered sequences, but this may change in the future, so consider avoiding using them.\n",
      "2019-08-11 09:56:59.220057: W tensorflow/core/common_runtime/eager/context.cc:371] Added two functions with the same name: __inference__wrapped_model_706\n",
      "2019-08-11 09:56:59.231267: W tensorflow/core/common_runtime/eager/context.cc:371] Added two functions with the same name: __inference__traced_restore_747\n",
      "2019-08-11 09:56:59.241731: W tensorflow/core/common_runtime/eager/context.cc:371] Added two functions with the same name: __inference__wrapped_model_781\n",
      "2019-08-11 09:56:59.246933: W tensorflow/core/common_runtime/eager/context.cc:371] Added two functions with the same name: __inference_signature_wrapper_793\n",
      "2019-08-11 09:56:59.256923: W tensorflow/core/common_runtime/eager/context.cc:371] Added two functions with the same name: __inference__traced_save_822\n",
      "2019-08-11 09:56:59.270489: W tensorflow/core/common_runtime/eager/context.cc:371] Added two functions with the same name: __inference_signature_wrapper_793\n",
      "2019-08-11 09:56:59.297805: I tensorflow/core/grappler/devices.cc:60] Number of eligible GPUs (core count >= 8, compute capability >= 0.0): 0 (Note: TensorFlow was not compiled with CUDA support)\n",
      "2019-08-11 09:56:59.297953: I tensorflow/core/grappler/clusters/single_machine.cc:359] Starting new session\n",
      "2019-08-11 09:56:59.302455: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:716] Optimization results for grappler item: graph_to_optimize\n",
      "2019-08-11 09:56:59.302496: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:718]   function_optimizer: Graph size after: 42 nodes (33), 71 edges (62), time = 1.447ms.\n",
      "2019-08-11 09:56:59.302507: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:718]   function_optimizer: function_optimizer did nothing. time = 0.026ms.\n",
      "2019-08-11 09:56:59.418624: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:716] Optimization results for grappler item: graph_to_optimize\n",
      "2019-08-11 09:56:59.418678: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:718]   debug_stripper: debug_stripper did nothing. time = 0.007ms.\n",
      "2019-08-11 09:56:59.418691: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:718]   model_pruner: Graph size after: 41 nodes (-1), 70 edges (-1), time = 0.377ms.\n",
      "2019-08-11 09:56:59.418705: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:718]   constant folding: Graph size after: 35 nodes (-6), 58 edges (-12), time = 15.24ms.\n",
      "2019-08-11 09:56:59.418721: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:718]   arithmetic_optimizer: Graph size after: 34 nodes (-1), 57 edges (-1), time = 5.668ms.\n",
      "2019-08-11 09:56:59.418732: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:718]   dependency_optimizer: Graph size after: 24 nodes (-10), 34 edges (-23), time = 0.907ms.\n",
      "2019-08-11 09:56:59.418742: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:718]   model_pruner: Graph size after: 24 nodes (0), 34 edges (0), time = 0.295ms.\n",
      "2019-08-11 09:56:59.418751: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:718]   remapper: Graph size after: 24 nodes (0), 34 edges (0), time = 0.404ms.\n",
      "2019-08-11 09:56:59.418761: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:718]   constant folding: Graph size after: 24 nodes (0), 34 edges (0), time = 7.96ms.\n",
      "2019-08-11 09:56:59.418771: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:718]   arithmetic_optimizer: Graph size after: 24 nodes (0), 34 edges (0), time = 2.205ms.\n",
      "2019-08-11 09:56:59.418781: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:718]   dependency_optimizer: Graph size after: 24 nodes (0), 34 edges (0), time = 0.61ms.\n",
      "2019-08-11 09:56:59.418791: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:718]   debug_stripper: debug_stripper did nothing. time = 0.024ms.\n",
      "2019-08-11 09:56:59.418801: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:718]   model_pruner: Graph size after: 24 nodes (0), 34 edges (0), time = 0.217ms.\n",
      "2019-08-11 09:56:59.418811: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:718]   constant folding: Graph size after: 24 nodes (0), 34 edges (0), time = 8.081ms.\n",
      "2019-08-11 09:56:59.418821: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:718]   arithmetic_optimizer: Graph size after: 24 nodes (0), 34 edges (0), time = 4.493ms.\n",
      "2019-08-11 09:56:59.418831: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:718]   dependency_optimizer: Graph size after: 24 nodes (0), 34 edges (0), time = 0.588ms.\n",
      "2019-08-11 09:56:59.418841: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:718]   model_pruner: Graph size after: 24 nodes (0), 34 edges (0), time = 0.268ms.\n",
      "2019-08-11 09:56:59.418851: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:718]   remapper: Graph size after: 24 nodes (0), 34 edges (0), time = 0.469ms.\n",
      "2019-08-11 09:56:59.418859: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:718]   constant folding: Graph size after: 24 nodes (0), 34 edges (0), time = 1.864ms.\n",
      "2019-08-11 09:56:59.418869: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:718]   arithmetic_optimizer: Graph size after: 24 nodes (0), 34 edges (0), time = 2.114ms.\n",
      "2019-08-11 09:56:59.418880: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:718]   dependency_optimizer: Graph size after: 24 nodes (0), 34 edges (0), time = 0.479ms.\n",
      "Writing weight file ./tfjs_models/keras_to_tfjs_graph/model.json...\n",
      "2019-08-11 09:56:59.441662: W tensorflow/compiler/jit/mark_for_compilation_pass.cc:1412] (One-time warning): Not using XLA:CPU for cluster because envvar TF_XLA_FLAGS=--tf_xla_cpu_global_jit was not set.  If you want XLA:CPU, either set that envvar, or use experimental_jit_scope to enable XLA:CPU.  To confirm that XLA is active, pass --vmodule=xla_compilation_cache=1 (as a proper command-line flag, not via TF_XLA_FLAGS) or set the envvar XLA_FLAGS=--xla_hlo_profile.\n",
      "Exception ignored in: <bound method _EagerDefinedFunctionDeleter.__del__ of <tensorflow.python.eager.function._EagerDefinedFunctionDeleter object at 0x7f1128304358>>\n",
      "Traceback (most recent call last):\n",
      "  File \"/home/stdcoutzyx/.local/lib/python3.5/site-packages/tensorflow/python/eager/function.py\", line 305, in __del__\n",
      "  File \"/home/stdcoutzyx/.local/lib/python3.5/site-packages/tensorflow/python/eager/context.py\", line 1663, in remove_function\n",
      "  File \"/home/stdcoutzyx/.local/lib/python3.5/site-packages/tensorflow/python/eager/context.py\", line 865, in remove_function\n",
      "TypeError: 'NoneType' object is not callable\n",
      "Exception ignored in: <bound method _EagerDefinedFunctionDeleter.__del__ of <tensorflow.python.eager.function._EagerDefinedFunctionDeleter object at 0x7f11282285c0>>\n",
      "Traceback (most recent call last):\n",
      "  File \"/home/stdcoutzyx/.local/lib/python3.5/site-packages/tensorflow/python/eager/function.py\", line 305, in __del__\n",
      "  File \"/home/stdcoutzyx/.local/lib/python3.5/site-packages/tensorflow/python/eager/context.py\", line 1663, in remove_function\n",
      "  File \"/home/stdcoutzyx/.local/lib/python3.5/site-packages/tensorflow/python/eager/context.py\", line 865, in remove_function\n",
      "TypeError: 'NoneType' object is not callable\n",
      "Exception ignored in: <bound method _EagerDefinedFunctionDeleter.__del__ of <tensorflow.python.eager.function._EagerDefinedFunctionDeleter object at 0x7f1128141860>>\n",
      "Traceback (most recent call last):\n",
      "  File \"/home/stdcoutzyx/.local/lib/python3.5/site-packages/tensorflow/python/eager/function.py\", line 305, in __del__\n",
      "  File \"/home/stdcoutzyx/.local/lib/python3.5/site-packages/tensorflow/python/eager/context.py\", line 1663, in remove_function\n",
      "  File \"/home/stdcoutzyx/.local/lib/python3.5/site-packages/tensorflow/python/eager/context.py\", line 865, in remove_function\n",
      "TypeError: 'NoneType' object is not callable\n",
      "Exception ignored in: <bound method _EagerDefinedFunctionDeleter.__del__ of <tensorflow.python.eager.function._EagerDefinedFunctionDeleter object at 0x7f11280f1a20>>\n",
      "Traceback (most recent call last):\n",
      "  File \"/home/stdcoutzyx/.local/lib/python3.5/site-packages/tensorflow/python/eager/function.py\", line 305, in __del__\n",
      "  File \"/home/stdcoutzyx/.local/lib/python3.5/site-packages/tensorflow/python/eager/context.py\", line 1663, in remove_function\n",
      "  File \"/home/stdcoutzyx/.local/lib/python3.5/site-packages/tensorflow/python/eager/context.py\", line 865, in remove_function\n",
      "TypeError: 'NoneType' object is not callable\n",
      "Exception ignored in: <bound method _EagerDefinedFunctionDeleter.__del__ of <tensorflow.python.eager.function._EagerDefinedFunctionDeleter object at 0x7f11281fcdd8>>\n",
      "Traceback (most recent call last):\n",
      "  File \"/home/stdcoutzyx/.local/lib/python3.5/site-packages/tensorflow/python/eager/function.py\", line 305, in __del__\n",
      "  File \"/home/stdcoutzyx/.local/lib/python3.5/site-packages/tensorflow/python/eager/context.py\", line 1663, in remove_function\n",
      "  File \"/home/stdcoutzyx/.local/lib/python3.5/site-packages/tensorflow/python/eager/context.py\", line 865, in remove_function\n",
      "TypeError: 'NoneType' object is not callable\n"
     ]
    }
   ],
   "source": [
    "!tensorflowjs_converter --input_format keras \\\n",
    "    --output_format tfjs_graph_model \\\n",
    "    ./graph_def_and_weights/fashion_mnist_model.h5 \\\n",
    "    ./tfjs_models/keras_to_tfjs_graph"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2019-08-11 09:58:40.197537: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA\n",
      "2019-08-11 09:58:40.203853: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 2300000000 Hz\n",
      "2019-08-11 09:58:40.204186: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x55ba4dd77fe0 executing computations on platform Host. Devices:\n",
      "2019-08-11 09:58:40.204241: I tensorflow/compiler/xla/service/service.cc:175]   StreamExecutor device (0): <undefined>, <undefined>\n",
      "2019-08-11 09:58:40.218191: W tensorflow/core/common_runtime/eager/context.cc:371] Added two functions with the same name: __inference_dense_layer_call_and_return_conditional_losses_12\n",
      "2019-08-11 09:58:40.221897: W tensorflow/core/common_runtime/eager/context.cc:371] Added two functions with the same name: __inference_dense_layer_call_fn_20\n",
      "2019-08-11 09:58:40.229470: W tensorflow/core/common_runtime/eager/context.cc:371] Added two functions with the same name: __inference_flatten_layer_call_and_return_conditional_losses_33\n",
      "2019-08-11 09:58:40.232262: W tensorflow/core/common_runtime/eager/context.cc:371] Added two functions with the same name: __inference_flatten_layer_call_fn_39\n",
      "2019-08-11 09:58:40.240981: W tensorflow/core/common_runtime/eager/context.cc:371] Added two functions with the same name: __inference__traced_save_70\n",
      "2019-08-11 09:58:40.245179: W tensorflow/core/common_runtime/eager/context.cc:371] Added two functions with the same name: __inference_dense_1_layer_call_and_return_conditional_losses_82\n",
      "2019-08-11 09:58:40.248129: W tensorflow/core/common_runtime/eager/context.cc:371] Added two functions with the same name: __inference_dense_1_layer_call_fn_90\n",
      "2019-08-11 09:58:40.257663: W tensorflow/core/common_runtime/eager/context.cc:371] Added two functions with the same name: __inference__wrapped_model_124\n",
      "2019-08-11 09:58:40.261657: W tensorflow/core/common_runtime/eager/context.cc:371] Added two functions with the same name: __inference_signature_wrapper_136\n",
      "2019-08-11 09:58:40.275928: W tensorflow/core/common_runtime/eager/context.cc:371] Added two functions with the same name: __inference__traced_restore_183\n",
      "2019-08-11 09:58:40.280440: W tensorflow/core/common_runtime/eager/context.cc:371] Added two functions with the same name: __inference_dense_2_layer_call_and_return_conditional_losses_195\n",
      "2019-08-11 09:58:40.285483: W tensorflow/core/common_runtime/eager/context.cc:371] Added two functions with the same name: __inference_sequential_layer_call_and_return_conditional_losses_210\n",
      "2019-08-11 09:58:40.289460: W tensorflow/core/common_runtime/eager/context.cc:371] Added two functions with the same name: __inference_sequential_layer_call_fn_222\n",
      "2019-08-11 09:58:40.294392: W tensorflow/core/common_runtime/eager/context.cc:371] Added two functions with the same name: __inference_sequential_layer_call_and_return_conditional_losses_237\n",
      "2019-08-11 09:58:40.299651: W tensorflow/core/common_runtime/eager/context.cc:371] Added two functions with the same name: __inference_sequential_layer_call_and_return_conditional_losses_252\n",
      "2019-08-11 09:58:40.303540: W tensorflow/core/common_runtime/eager/context.cc:371] Added two functions with the same name: __inference_sequential_layer_call_fn_264\n",
      "2019-08-11 09:58:40.306639: W tensorflow/core/common_runtime/eager/context.cc:371] Added two functions with the same name: __inference_dense_2_layer_call_fn_272\n",
      "2019-08-11 09:58:40.311637: W tensorflow/core/common_runtime/eager/context.cc:371] Added two functions with the same name: __inference_sequential_layer_call_and_return_conditional_losses_287\n",
      "2019-08-11 09:58:40.339584: W tensorflow/core/common_runtime/eager/context.cc:371] Added two functions with the same name: __inference_signature_wrapper_136\n",
      "2019-08-11 09:58:40.382503: I tensorflow/core/grappler/devices.cc:60] Number of eligible GPUs (core count >= 8, compute capability >= 0.0): 0 (Note: TensorFlow was not compiled with CUDA support)\n",
      "2019-08-11 09:58:40.382647: I tensorflow/core/grappler/clusters/single_machine.cc:359] Starting new session\n",
      "2019-08-11 09:58:40.386043: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:716] Optimization results for grappler item: graph_to_optimize\n",
      "2019-08-11 09:58:40.386086: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:718]   function_optimizer: Graph size after: 42 nodes (33), 71 edges (62), time = 1.336ms.\n",
      "2019-08-11 09:58:40.386097: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:718]   function_optimizer: function_optimizer did nothing. time = 0.028ms.\n",
      "2019-08-11 09:58:40.478645: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:716] Optimization results for grappler item: graph_to_optimize\n",
      "2019-08-11 09:58:40.478704: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:718]   debug_stripper: debug_stripper did nothing. time = 0.012ms.\n",
      "2019-08-11 09:58:40.478717: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:718]   model_pruner: Graph size after: 41 nodes (-1), 70 edges (-1), time = 0.398ms.\n",
      "2019-08-11 09:58:40.478728: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:718]   constant folding: Graph size after: 35 nodes (-6), 58 edges (-12), time = 7.582ms.\n",
      "2019-08-11 09:58:40.478736: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:718]   arithmetic_optimizer: Graph size after: 34 nodes (-1), 57 edges (-1), time = 2.464ms.\n",
      "2019-08-11 09:58:40.478747: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:718]   dependency_optimizer: Graph size after: 24 nodes (-10), 34 edges (-23), time = 0.695ms.\n",
      "2019-08-11 09:58:40.478759: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:718]   model_pruner: Graph size after: 24 nodes (0), 34 edges (0), time = 0.247ms.\n",
      "2019-08-11 09:58:40.478769: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:718]   remapper: Graph size after: 24 nodes (0), 34 edges (0), time = 0.444ms.\n",
      "2019-08-11 09:58:40.478779: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:718]   constant folding: Graph size after: 24 nodes (0), 34 edges (0), time = 4.438ms.\n",
      "2019-08-11 09:58:40.478791: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:718]   arithmetic_optimizer: Graph size after: 24 nodes (0), 34 edges (0), time = 1.701ms.\n",
      "2019-08-11 09:58:40.478802: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:718]   dependency_optimizer: Graph size after: 24 nodes (0), 34 edges (0), time = 0.463ms.\n",
      "2019-08-11 09:58:40.478811: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:718]   debug_stripper: debug_stripper did nothing. time = 0.021ms.\n",
      "2019-08-11 09:58:40.478821: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:718]   model_pruner: Graph size after: 24 nodes (0), 34 edges (0), time = 0.211ms.\n",
      "2019-08-11 09:58:40.478831: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:718]   constant folding: Graph size after: 24 nodes (0), 34 edges (0), time = 3.013ms.\n",
      "2019-08-11 09:58:40.478841: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:718]   arithmetic_optimizer: Graph size after: 24 nodes (0), 34 edges (0), time = 1.892ms.\n",
      "2019-08-11 09:58:40.478851: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:718]   dependency_optimizer: Graph size after: 24 nodes (0), 34 edges (0), time = 1.13ms.\n",
      "2019-08-11 09:58:40.478862: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:718]   model_pruner: Graph size after: 24 nodes (0), 34 edges (0), time = 0.272ms.\n",
      "2019-08-11 09:58:40.478872: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:718]   remapper: Graph size after: 24 nodes (0), 34 edges (0), time = 0.963ms.\n",
      "2019-08-11 09:58:40.478882: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:718]   constant folding: Graph size after: 24 nodes (0), 34 edges (0), time = 3.301ms.\n",
      "2019-08-11 09:58:40.478892: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:718]   arithmetic_optimizer: Graph size after: 24 nodes (0), 34 edges (0), time = 2.182ms.\n",
      "2019-08-11 09:58:40.478902: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:718]   dependency_optimizer: Graph size after: 24 nodes (0), 34 edges (0), time = 1.139ms.\n",
      "Writing weight file ./tfjs_models/saved_model_to_tfjs_model/model.json...\n",
      "2019-08-11 09:58:40.504045: W tensorflow/compiler/jit/mark_for_compilation_pass.cc:1412] (One-time warning): Not using XLA:CPU for cluster because envvar TF_XLA_FLAGS=--tf_xla_cpu_global_jit was not set.  If you want XLA:CPU, either set that envvar, or use experimental_jit_scope to enable XLA:CPU.  To confirm that XLA is active, pass --vmodule=xla_compilation_cache=1 (as a proper command-line flag, not via TF_XLA_FLAGS) or set the envvar XLA_FLAGS=--xla_hlo_profile.\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Exception ignored in: <bound method _EagerDefinedFunctionDeleter.__del__ of <tensorflow.python.eager.function._EagerDefinedFunctionDeleter object at 0x7f9e1c2e9160>>\r\n",
      "Traceback (most recent call last):\r\n",
      "  File \"/home/stdcoutzyx/.local/lib/python3.5/site-packages/tensorflow/python/eager/function.py\", line 305, in __del__\r\n",
      "AttributeError: 'NoneType' object has no attribute 'remove_function'\r\n",
      "Exception ignored in: <bound method _EagerDefinedFunctionDeleter.__del__ of <tensorflow.python.eager.function._EagerDefinedFunctionDeleter object at 0x7f9e1d37b128>>\r\n",
      "Traceback (most recent call last):\r\n",
      "  File \"/home/stdcoutzyx/.local/lib/python3.5/site-packages/tensorflow/python/eager/function.py\", line 305, in __del__\r\n",
      "AttributeError: 'NoneType' object has no attribute 'remove_function'\r\n",
      "Exception ignored in: <bound method _EagerDefinedFunctionDeleter.__del__ of <tensorflow.python.eager.function._EagerDefinedFunctionDeleter object at 0x7f9e1c322908>>\r\n",
      "Traceback (most recent call last):\r\n",
      "  File \"/home/stdcoutzyx/.local/lib/python3.5/site-packages/tensorflow/python/eager/function.py\", line 305, in __del__\r\n",
      "AttributeError: 'NoneType' object has no attribute 'remove_function'\r\n",
      "Exception ignored in: <bound method _EagerDefinedFunctionDeleter.__del__ of <tensorflow.python.eager.function._EagerDefinedFunctionDeleter object at 0x7f9e1c30c6d8>>\r\n",
      "Traceback (most recent call last):\r\n",
      "  File \"/home/stdcoutzyx/.local/lib/python3.5/site-packages/tensorflow/python/eager/function.py\", line 305, in __del__\r\n",
      "AttributeError: 'NoneType' object has no attribute 'remove_function'\r\n",
      "Exception ignored in: <bound method _EagerDefinedFunctionDeleter.__del__ of <tensorflow.python.eager.function._EagerDefinedFunctionDeleter object at 0x7f9e1d398278>>\r\n",
      "Traceback (most recent call last):\r\n",
      "  File \"/home/stdcoutzyx/.local/lib/python3.5/site-packages/tensorflow/python/eager/function.py\", line 305, in __del__\r\n",
      "AttributeError: 'NoneType' object has no attribute 'remove_function'\r\n",
      "Exception ignored in: <bound method _EagerDefinedFunctionDeleter.__del__ of <tensorflow.python.eager.function._EagerDefinedFunctionDeleter object at 0x7f9e1c2fd898>>\r\n",
      "Traceback (most recent call last):\r\n",
      "  File \"/home/stdcoutzyx/.local/lib/python3.5/site-packages/tensorflow/python/eager/function.py\", line 305, in __del__\r\n",
      "AttributeError: 'NoneType' object has no attribute 'remove_function'\r\n",
      "Exception ignored in: <bound method _EagerDefinedFunctionDeleter.__del__ of <tensorflow.python.eager.function._EagerDefinedFunctionDeleter object at 0x7f9e1d39e828>>\r\n",
      "Traceback (most recent call last):\r\n",
      "  File \"/home/stdcoutzyx/.local/lib/python3.5/site-packages/tensorflow/python/eager/function.py\", line 305, in __del__\r\n",
      "AttributeError: 'NoneType' object has no attribute 'remove_function'\r\n",
      "Exception ignored in: <bound method _EagerDefinedFunctionDeleter.__del__ of <tensorflow.python.eager.function._EagerDefinedFunctionDeleter object at 0x7f9e1c2af748>>\r\n",
      "Traceback (most recent call last):\r\n",
      "  File \"/home/stdcoutzyx/.local/lib/python3.5/site-packages/tensorflow/python/eager/function.py\", line 305, in __del__\r\n",
      "AttributeError: 'NoneType' object has no attribute 'remove_function'\r\n",
      "Exception ignored in: <bound method _EagerDefinedFunctionDeleter.__del__ of <tensorflow.python.eager.function._EagerDefinedFunctionDeleter object at 0x7f9e1d3cecc0>>\r\n",
      "Traceback (most recent call last):\r\n",
      "  File \"/home/stdcoutzyx/.local/lib/python3.5/site-packages/tensorflow/python/eager/function.py\", line 305, in __del__\r\n",
      "AttributeError: 'NoneType' object has no attribute 'remove_function'\r\n",
      "Exception ignored in: <bound method _EagerDefinedFunctionDeleter.__del__ of <tensorflow.python.eager.function._EagerDefinedFunctionDeleter object at 0x7f9e1c3220b8>>\r\n",
      "Traceback (most recent call last):\r\n",
      "  File \"/home/stdcoutzyx/.local/lib/python3.5/site-packages/tensorflow/python/eager/function.py\", line 305, in __del__\r\n",
      "AttributeError: 'NoneType' object has no attribute 'remove_function'\r\n",
      "Exception ignored in: <bound method _EagerDefinedFunctionDeleter.__del__ of <tensorflow.python.eager.function._EagerDefinedFunctionDeleter object at 0x7f9e1c343400>>\r\n",
      "Traceback (most recent call last):\r\n",
      "  File \"/home/stdcoutzyx/.local/lib/python3.5/site-packages/tensorflow/python/eager/function.py\", line 305, in __del__\r\n",
      "AttributeError: 'NoneType' object has no attribute 'remove_function'\r\n"
     ]
    }
   ],
   "source": [
    "!tensorflowjs_converter --input_format tf_saved_model \\\n",
    "    --output_format tfjs_graph_model \\\n",
    "    ./keras_saved_graph/ \\\n",
    "    ./tfjs_models/saved_model_to_tfjs_model"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Traceback (most recent call last):\r\n",
      "  File \"/usr/local/bin/tensorflowjs_converter\", line 11, in <module>\r\n",
      "    sys.exit(main())\r\n",
      "  File \"/home/stdcoutzyx/.local/lib/python3.5/site-packages/tensorflowjs/converters/converter.py\", line 622, in main\r\n",
      "    (input_format, output_format))\r\n",
      "ValueError: Unsupported input_format - output_format pair: tf_saved_model - tfjs_layers_model\r\n"
     ]
    }
   ],
   "source": [
    "!tensorflowjs_converter --input_format tf_saved_model \\\n",
    "    --output_format tfjs_layers_model \\\n",
    "    ./keras_saved_graph/ \\\n",
    "    ./tfjs_models/saved_model_to_tfjs_layers"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
